<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('通用物流轨迹页面')" />
    <style type="text/css">
    	.layui-form-label{width: 80px;}
    	.layui-input-block{margin-left: 90px;}
    	.layui-timeline{margin: 20px 50px;text-align: center;}
    	.layui-timeline li{text-align: left;}
	</style>
</head>
<body class="no-skin">
	<form  class="layui-form layui-card-header layuiadmin-card-header-auto">
		<div class="layui-form-item margin_t0">
			<div class="layui-inline margin_r0 layui-col-sm3">
				<label class="layui-form-label">
                	<font>快递公司：</font>
              	</label>
               	<div class="layui-input-block">
                    <select type="text" id="expCode" name="expCode" autocomplete="off" class="layui-select" lay-search th:with="map=${@baseinfosimple.getDropdownData('TB_baseinfo_fhwl','vAccountName','vname')}" lay-verify="required">
						<option></option>
						<option th:each="dict : ${map}" th:text="${dict.vname}" th:value="${dict.vid}" th:selected="${dict.vname eq param.expCode.toString()}"></option>
					</select>
				</div>
            </div>
			<div class="layui-inline margin_r0 layui-col-sm4">
               	<label class="layui-form-label">
                	<font>快递单号：</font>
              	</label>
               	<div class="layui-input-block">
                    <input type="text" id="expNo" name="expNo" th:value="${param.expNo}" class="layui-input" autocomplete="off" lay-verify="required">
				</div>
            </div>
			<div class="layui-inline margin_r0 layui-col-sm3">
               	<label class="layui-form-label">
                	<font>手机号：</font>
              	</label>
               	<div class="layui-input-block">
                    <input type="text" id="client" name="client" th:value="${param.client}" class="layui-input" autocomplete="off" placeholder="主要后四位">
				</div>
            </div>
			<div class="layui-inline margin_r0 layui-col-sm2">
				<a class="layui-btn layuiadmin-btn-order dhicon dh-search" id="btn-search" lay-submit="" lay-filter="submit" style="margin-left:15px"><span class="fa_span">查询</span></a>
            </div>
		</div>
	</form>
	<ul class="layui-timeline" id="timeWL">
		请输入后查询！
	</ul>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
	/*<![CDATA[*/
	var prefix = [[${prefix}]],
		wlzt = [[${@baseinfosimple.getDropdownData('TB_baseinfo_wlzt','vid','vname')}]],
		zzwlzt = [[${@baseinfosimple.getDropdownData('TB_baseinfo_zzwlzt','vid','vname')}]];
	/*]]>*/
</script>
<script type="text/javascript">
var $,layer,form;
layui.use(['layer','jquery','form'], function () {
	$ = layui.$,layer = layui.layer,form = layui.form;
	form.on('submit(submit)', function(data){
		if((data.field.client && data.field.client.length >3) || !data.field.client){//如果填写手机号，则位数不少于4位
			$.get(prefix+'/wlcx',data.field,function(res){
				if(res.state){//成功请求
					var timeHtml = '';
					if(res.reason)$('#timeWL').html(res.reason);
					else{
						$.each(res.traces,function(i,v){
							timeHtml += "<li class='layui-timeline-item'>";
							timeHtml += "<i class='layui-icon layui-timeline-axis'>&#xe63f;</i>";
							timeHtml += "<div class='layui-timeline-content layui-text'>";
							timeHtml += "<h3 class='layui-timeline-title'>" + v.acceptTime;
							var vzzwlzt='';
							$.each(zzwlzt,function(ii,vv){
								if(vv.vid == v.action.substring(0,1) || vv.vid == v.action)vzzwlzt=vv.vname;
							})
							timeHtml += "<span style='float: right'>" + vzzwlzt + "</span>";
							timeHtml += "</h3><p>";
							$.each(v.acceptStation.split('。'),function(ii,vv){
								if(ii)timeHtml += '<br>' + vv;
								else timeHtml += vv;
							})
							if(v.remark)timeHtml += '<br>备注：' +v.remark;
							timeHtml += "</p></div></li>";
						})
						$('#timeWL').html(timeHtml);//暂无轨迹信息
					}
				}else $.operate.ajaxSuccess(res);
			})
		}else layer.msg('输入手机号不少于四位！', {icon: 2});
	}); 
});
</script>
</body>
</html>